home *** CD-ROM | disk | FTP | other *** search
- /**************************************************************
- * BDisplayOutput.c
- *
- * SUPERCLASS = BEditDoc
- *
- * Display the contents of a Handle in a text screen. It requires
- * a floating window desktop
- * Window resource with id of 500 must be in resource file.
- *
- * © copyright 1991, KSS Scientific Consultants.
- *
- **************************************************************/
-
- #include <CApplication.h>
- #include <CBureaucrat.h>
- #include <CScrollPane.h>
- #include <CSwitchboard.h>
- #include <CWindow.h>
- #include <commands.h>
- #include <string.h>
- #include "BDisplayOutput.h"
- #include "BEditPane.h"
-
- #define WINDculture 500 // Resource ID for WIND template
-
- extern CApplication *gApplication;
- extern CBureaucrat *gGopher;
- extern CDesktop *gDesktop; // The visible Desktop
- //Boolean BDisplayOutput::fQuitStatus = FALSE;
-
- /*****************************************************************
- * IBDisplayOutput()
- *
- * Initialization method.
- *
- ****************************************************************/
-
- void BDisplayOutput::IBDisplayOutput(CApplication *anApplication, Boolean printable)
- {
- inherited::IEditDoc(anApplication, printable);
- }
-
- /******************************************************************
- * BuildWindow
- *
- * Override BuildWindow so a floating window is created and it is
- * not positioned by the Decorator.
- *
- *******************************************************************/
-
- void BDisplayOutput::BuildWindow (Handle theData)
-
- {
- CScrollPane *theScrollPane;
- BEditPane *theMainPane;
- Rect margin;
-
- itsWindow = new(CWindow);
- itsWindow->IWindow(WINDculture, TRUE, gDesktop, this);
- itsWindow->Move(40, 60);
-
- theScrollPane = new(CScrollPane);
-
- theScrollPane->IScrollPane(itsWindow, this, 10, 10, 0, 0,
- sizELASTIC, sizELASTIC,
- TRUE, TRUE, TRUE);
-
- theScrollPane->FitToEnclFrame(TRUE, TRUE);
-
- theMainPane = new(BEditPane);
- itsMainPane = theMainPane;
- itsGopher = theMainPane;
-
- theMainPane->IEditPane(theScrollPane, this);
-
- theScrollPane->InstallPanorama(theMainPane);
-
- if (theData)
- theMainPane->SetTextHandle(theData);
-
- //gDecorator->PlaceNewWindow(itsWindow);
- }
-
- /**********************************************************
- * EventManagement()
- *
- * Event control loop
- *
- **********************************************************/
-
- void BDisplayOutput::EventManagement(void)
- {
- SetQuitStatus(FALSE);
- do
- {
- gApplication->itsSwitchboard->ProcessEvent();
- } while (GetQuitStatus() == FALSE);
- }
-
- /*****************************************************************
- * DisplayRun()
- *
- * Entry method.
- *
- ****************************************************************/
-
- void BDisplayOutput::DisplayRun(Handle theText)
- {
- long tempLong;
-
- BuildWindow(0L);
- itsWindow->Select();
-
- tempLong = strlen(*theText);
- SetHandleSize(theText, tempLong);
- ((BEditPane*)itsMainPane)->SetTextHandle(theText);
-
- gGopher = itsGopher;
- EventManagement();
-
- }
-
- /********************************************************************
- * CloseWind()
- *
- * Add code to change QuitStatus to TRUE
- *
- ********************************************************************/
-
- void BDisplayOutput::CloseWind(CWindow *theWindow)
- {
- SetQuitStatus(TRUE);
-
- }
-
- /**********************************************************************
- * DoCommand()
- *
- * Respond to menu.
- *
- *********************************************************************/
-
- void BDisplayOutput::DoCommand(long theCommand)
- {
- switch (theCommand)
- {
- case cmdQuit:
- SetQuitStatus(TRUE);
- break;
-
- default: inherited::DoCommand(theCommand);
- break;
- }
- }
-
- /**********************************************************************
- * SetQuitStatus()
- *
- * Set or reset fQuitStatus.
- *
- *********************************************************************/
-
- void BDisplayOutput::SetQuitStatus(Boolean status)
- {
- fQuitStatus = status;
- }
-
- /**********************************************************************
- * GetQuitStatus()
- *
- * Get the status fQuitStatus.
- *
- **********************************************************************/
-
- Boolean BDisplayOutput::GetQuitStatus(void)
- {
- return (fQuitStatus);
- }